import { ref } from "vue"
import store from "@/store"
import { defineStore } from "pinia"
export const useCommonStore = defineStore(
  "common",
  () => {
    // const DOWNLOADWORD = ref<any>("ZGM5ODk4QC4u")
    const DOWNLOADWORD = ref<any>("dc9898@..")
    const xdnum = ref<any>(314)
    const theme = ref<any>("normal")
    const openBtn = ref<boolean>(false)
    const clientIDList = ref<any>([
      {
        name: "平台1",
        code: "ef944529d4fb4ab3932ab7ed7db6084a",
        index: 0
      },
      {
        name: "平台2",
        code: "4687e766b26348eabfdde1c1295fb6d3",
        index: 1
      }
    ])

    /** 设置模拟数字列表 */
    const setxdnum = (value: any) => {
      xdnum.value = value
    }

    /** 设置抖音自动提交开关*/
    const setOpenBtn = (value: any) => {
      openBtn.value = value
    }
    /**主题*/
    const setThemeStore = (value: any) => {
      theme.value = value
    }
    /**actions */
    {
      /** */
    }
    /**actions END */
    return {
      DOWNLOADWORD,
      xdnum,
      setxdnum,
      openBtn,
      clientIDList,
      setOpenBtn,
      theme,
      setThemeStore
    }
  },
  {
    persist: {
      enabled: true,
      strategies: [
        {
          storage: localStorage
          // paths: ["jobListStore", "authListStore"] //指定要长久化的字段
        }
      ]
    }
  }
)
/** 在 setup 外使用 */
export function useCommonStoreHook() {
  return useCommonStore(store)
}
